import {RSA} from 'react-native-rsa-native';
// 密钥对生成 http://web.chacuo.net/netrsakeypair; 把下面生成的公钥、私钥换成自己生成的即可
const publicKey =
  '-----BEGIN PUBLIC KEY-----' +
  '\n' +
  'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDbBm6lmsvfQI7DpLSiTSOy+kfjyi/VcBklGAxEwZb5XbZ3WJXTlOUA2thXjjVg5v2zg9bbwQv2fSkiyK9P1g1JnmzA+yELK9bvmvDmEyxjVnHrgnh4o/E+sOGiBf3+zA1B8xZzEk11FAPOLF6WbHDR0ZL9vc4K9oCit02rETZw2QIDAQAB' +
  '\n' +
  '-----END PUBLIC KEY-----' +
  '\n';

export async function encrypt(txt: string) {
  const data = await RSA.encrypt(txt, publicKey);
  return data; // 对数据进行加密
}
